/* Copyright (c) 2004-2024 peigen.info. All rights reserved. */

package info.peigen.hotpot.manage.core.util.convertor;

import info.peigen.hotpot.manage.core.domain.Relation;
import info.peigen.hotpot.manage.core.repository.entity.RelationEntity;
import info.peigen.hotpot.manage.core.service.order.RelationCreateOrder;
import info.peigen.hotpot.manage.core.service.order.RelationEditOrder;
import info.peigen.hotpot.manage.core.service.result.info.RelationInfo;

import org.mapstruct.Builder;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;

import java.util.List;

/**
 * <b>(RelationConvertor)</b>
 * "关联关系" 转换器
 *
 * @author Peigen
 * @version 1.0.0
 * @since 2024-06-28
 */
@SuppressWarnings("unused")
@Mapper(builder = @Builder(disableBuilder = true))
public interface RelationConvertor {
    RelationConvertor INSTANCE = Mappers.getMapper(RelationConvertor.class);

    // ConvertToEntity
    RelationEntity convertToEntity(Relation domain);
    List<RelationEntity> convertToEntitiesByDomain(List<Relation> domains);

    RelationEntity convertToEntity(RelationInfo relationInfo);
    List<RelationEntity> convertToEntitiesByInfo(List<RelationInfo> relationInfo);

    // ConvertToDomain
    Relation convertToDomain(RelationEntity entity);
    List<Relation> convertToDomainsByEntity(List<RelationEntity> entities);
    Relation convertToDomain(RelationInfo relationInfo);
    List<Relation> convertToDomainsByInfo(List<RelationInfo> infos);

    Relation convertToDomain(RelationCreateOrder order);
    Relation convertToDomain(RelationEditOrder order);

    // ConvertToInfo
    RelationInfo convertToInfo(Relation domain);
    List<RelationInfo> convertToInfosByDomain(List<Relation> domains);

    RelationInfo convertToInfo(RelationEntity entity);
    List<RelationInfo> convertToInfosByEntity(List<RelationEntity> entities);
}